/*
 * Copyright (c) 2022 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { ShortcutCombination } from './ShortcutCombination.js';
/**
 * Calculates the logical disjunction of multiple matchers. Evaluation is shortcut, so
 * subsequent matchers are not called if an earlier matcher returns <code>true</code>.
 */
export class AnyOf extends ShortcutCombination {
    constructor(matchers) {
        super(matchers);
    }
    matches(o) {
        return super.matchesWithShortcut(o, true);
    }
    describeTo(description) {
        super.describeToWithShortcut(description, "or");
    }
    /**
     * Creates a matcher that matches if the examined object matches <b>ANY</b> of the specified matchers.
     * For example:
     * <pre>assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))</pre>
     *
     * @param <T>
     *     the matcher type.
     * @param matchers
     *     any the matchers must pass.
     * @return The matcher.
     */
    static anyOf(matchers) {
        return new AnyOf(matchers);
    }
    /**
     * Creates a matcher that matches if the examined object matches <b>ANY</b> of the specified matchers.
     * For example:
     * <pre>assertThat("myValue", anyOf(startsWith("foo"), containsString("Val")))</pre>
     *
     * @param <T>
     *     the matcher type.
     * @param matchers
     *     any the matchers must pass.
     * @return The matcher.
     */
    static anyOfMatches(...matchers) {
        return AnyOf.anyOf(matchers);
    }
}
